package com.vframework.rest.resources;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.vframework.rest.common.RestResponse;
import com.vframework.rest.service.RegionService;

@Component
@Path("region")
public class RegionResource {
    
    @Autowired
    private RegionService regionService;
	@Path("getRegions")
	@GET
	@Produces(MediaType.APPLICATION_JSON)
	public Response getRegions() {
	    RestResponse restResponse = null;
        try {
            restResponse = regionService.listAllAreaAsTree();
        } catch (Exception e) {
            e.printStackTrace();
        }
		return Response.status(Response.Status.OK).entity(restResponse).build();
	}
}
